package com.yidu.best.bond.casharapInventory.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yidu.best.bond.casharapInventory.dao.CasharapInventoryDao;
import com.yidu.best.bond.casharapInventory.domain.CasharapInventory;
import com.yidu.best.bond.casharapInventory.domain.CasharapInventoryVo;
import com.yidu.best.bond.casharapInventory.service.CasharapInventoryService;

@Service
public class CasharapInventoryServiceImpl implements CasharapInventoryService{
	@Autowired
	private CasharapInventoryDao casharapInventoryDao;
	
	@Override
	public Map<String, Object> findPageQuery(CasharapInventoryVo casharapInventoryVo) {
		// 调用dao层方法查询数量
		int count = casharapInventoryDao.countCasharapInventory(casharapInventoryVo);
		// 计算页码
		int page = (casharapInventoryVo.getPage() - 1) * casharapInventoryVo.getLimit();
		casharapInventoryVo.setPage(page);
		// 调用dao层方法分页查询
		List<CasharapInventory> capitalTransferList = casharapInventoryDao.findPageQuery(casharapInventoryVo);
		Map<String, Object> map = new HashMap<String, Object>();
		// 将数据存入map中
		map.put("code", 0);
		map.put("count", count);
		map.put("data", capitalTransferList);
		return map;
	}
}
